package mistic.storage;

public class Registro {
	private String usuario;
	private byte[] claveHash;
	private byte[] salt;
	private String roles;
	private int fallos;


	public Registro(byte[] claveHash,byte[] salt,String string) {
		this.claveHash = claveHash;
		this.salt = salt;
		this.fallos  = Integer.parseInt(string.split(",")[0]);
		this.usuario = (string.split(",")[1]).trim();
		this.roles   = (string.split(",")[2]).trim();
	}
	public String getUsuario() {
		return usuario;
	}
	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}
	public String getRoles() {
		return roles;
	}
	public void setRoles(String roles) {
		this.roles = roles;
	}
	public byte[] getClaveHash() {
		return claveHash;
	}
	public void setClaveHash(byte[] claveHash) {
		this.claveHash = claveHash;
	}
	public byte[] getSalt() {
		return salt;
	}
	public void setSalt(byte[] salt) {
		this.salt = salt;
	}
	public int getFallos() {
		return fallos;
	}

	public void setFallos(int fallos) {
		this.fallos = fallos;
	}

    public boolean tieneElRol(String unRol){
    	return (roles.contains(unRol));
    }
	
}
